//
//  ViewController.m
//  观察者模式
//
//  Created by flannery on 2018/12/19.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "ViewController.h"
#import "Subject.h"
#import "Observer.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    Subject *subject = Subject.new;
    
    HexaObserver *hexa = [[HexaObserver alloc]initWithSubject:subject];
    OctalObserver *octal = [[OctalObserver alloc] initWithSubject:subject];
    BinaryObserver *binary = [[BinaryObserver alloc] initWithSubject:subject];
    
    NSLog(@"First state change: 15");
    [subject setState:15];
    NSLog(@"Second state change: 10");
    [subject setState:10];
}


@end
